#ifndef ROOMMANAGER_H
#define ROOMMANAGER_H

#include <QMap>
#include "room.h"
#include "../common/singleton.h"

/**
 * @brief The RoomManager class
 * @brief 管理已连接房间
 */
class RoomManager
{
    friend class SingleTon<RoomManager>;
    RoomManager();
    RoomManager(const RoomManager&)=delete ;
    RoomManager(RoomManager&&)=delete ;

private:
    QMap<QString,Room*> roomMap;

public:
    ~RoomManager();
    void appendRoom(QString& roomID, QString& host,Socket *anchor);
    void removeRoom(QString& roomID);
    QString& getRoomHost(QString& roomID);
    QMap<QString,Room*>& getRooms() {return roomMap;}
    Room* getRoom(QString roomID) {return roomMap[roomID];}
};

#endif // ROOMMANAGER_H
